define(function (require) {
    var _common = require('common/main');
    var _config = require('common/config');
    var _send = _common.sendRequest;
    function init() {
    	var _param = {};
    	_send("food/listFoodDetail.ajax",_param,_list_food_render);
    	
    }
    function _list_food_render(data)
    {
    	var _html = '';
    	var _drinkhtml = '';
    	var _len = data.length;
    	for (var i = 0; i < _len; i++) 
    	{
			var _item = data[i];
			if(_item.type==1)
			{
				_html += '<tr>';
				_html += '<td width="10%">';
				_html += _item.id;
				_html += '</td>';
				
				_html += '<td width="10%">';
				_html += _item.name;
				_html += '</td>';
				
				_html += '<td width="15%">';
				_html += '<img style="width:100px;height:100px" src="';
				_html += _item.imagepath;
				_html += '"/>';
				_html += '</td>';
				
				_html += '<td width="15%">';
				_html += '<img style="width:100px;height:100px" src="';
				_html += _item.imagepathpc;
				_html += '"/>';
				_html += '</td>';
				
				_html += '<td width="5%">';
				_html += _item.price;
				_html += '</td>';
				
				_html += '<td width="25%">';
				_html += _item.desc;
				_html += '</td>';
				
				_html += '<td width="15%">';
				_html += _item.value;
				_html += '</td>';

				_html += '<td width="5%">';
				_html += _item.tags;
				_html += '</td>';
				
				_html += '<td width="5%">';
				_html += _item.state;
				_html += '</td>';
				
				_html += '<td width="5%">';
				_html += _item.sequence;
				_html += '</td>';
				
				_html += '<td width="10%">';
				_html += '<a href="javascript:_food_mod(';
				_html += _item.id;
				_html += ');">编辑</a>&nbsp;&nbsp;&nbsp;&nbsp;';
				
				_html += '<a href="javascript:_food_del(';
				_html += _item.id;
				_html += ');">删除</a>';
				_html += '</td>';
				_html += '</tr>'
			}
			if(_item.type==2)
			{
				_drinkhtml += '<tr>';
				_drinkhtml += '<td width="10%">';
				_drinkhtml += _item.id;
				_drinkhtml += '</td>';
				
				_drinkhtml += '<td width="10%">';
				_drinkhtml += _item.name;
				_drinkhtml += '</td>';
				
				_drinkhtml += '<td width="15%">';
				_drinkhtml += '<img style="width:100px;height:100px" src="';
				_drinkhtml += _item.imagepath;
				_drinkhtml += '"/>';
				_drinkhtml += '</td>';
				
				_drinkhtml += '<td width="15%">';
				_drinkhtml += '<img style="width:100px;height:100px" src="';
				_drinkhtml += _item.imagepathpc;
				_drinkhtml += '"/>';
				_drinkhtml += '</td>';
				
				_drinkhtml += '<td width="5%">';
				_drinkhtml += _item.price;
				_drinkhtml += '</td>';
				
				_drinkhtml += '<td width="25%">';
				_drinkhtml += _item.desc;
				_drinkhtml += '</td>';
				
				_drinkhtml += '<td width="15%">';
				_drinkhtml += _item.value;
				_drinkhtml += '</td>';

				_drinkhtml += '<td width="5%">';
				_drinkhtml += _item.tags;
				_drinkhtml += '</td>';
				
				_drinkhtml += '<td width="5%">';
				_drinkhtml += _item.state;
				_drinkhtml += '</td>';
				
				_drinkhtml += '<td width="5%">';
				_drinkhtml += _item.sequence;
				_drinkhtml += '</td>';
				
				_drinkhtml += '<td width="10%">';
				_drinkhtml += '<a href="javascript:_food_mod(';
				_drinkhtml += _item.id;
				_drinkhtml += ');">编辑</a>&nbsp;&nbsp;&nbsp;&nbsp;';
				
				_drinkhtml += '<a href="javascript:_food_del(';
				_drinkhtml += _item.id;
				_drinkhtml += ');">删除</a>';
				_drinkhtml += '</td>';
				_drinkhtml += '</tr>'
			}
    	}
    	$('#food_main_list').html(_html);
    	$('#food_drink_list').html(_drinkhtml);
    }
    
    return { init: init };
});